import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:htxd_flutter_mapbox_sdk/entity/village_land_entity.dart';

/// 显示已有地块信息 dialog
void showVillageLandInfoDialog(
    {required BuildContext context,
    required VillageLandEntity villageLandEntity}) {
  showDialog(
      context: context,
      builder: (context) {
        return VillageLandInfoDialog(
          villageLandEntity: villageLandEntity,
        );
      });
}

class VillageLandInfoDialog extends StatelessWidget {
  VillageLandEntity villageLandEntity;

  VillageLandInfoDialog({Key? key, required this.villageLandEntity})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Container(
        decoration: BoxDecoration(
          color: Colors.white,
          borderRadius: BorderRadius.circular(10.w),
        ),
        width: double.infinity,
        padding: EdgeInsets.only(bottom: 20.w),
        margin: EdgeInsets.symmetric(horizontal: 30.w),
        child: Column(
          mainAxisSize: MainAxisSize.min,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Align(
              alignment: Alignment.topRight,
              child: GestureDetector(
                onTap: () {
                  Navigator.of(context).pop();
                },
                child: Container(
                  width: 30.w,
                  height: 30.w,
                  child: Icon(
                    Icons.close,
                    size: 20.w,
                  ),
                ),
              ),
            ),
            Text(
              "地块面积:${villageLandEntity.landArea}",
              style: TextStyle(color: Colors.black, fontSize: 16.sp),
            ),
            SizedBox(
              height: 5.w,
            ),
            Text(
              "被保险人:${villageLandEntity.insured}",
              style: TextStyle(color: Colors.black, fontSize: 16.sp),
            ),
            SizedBox(
              height: 5.w,
            ),
            Text(
              "险种:${villageLandEntity.insurance}",
              style: TextStyle(color: Colors.black, fontSize: 16.sp),
            ),
            SizedBox(
              height: 5.w,
            ),
            Text(
              "期限:${villageLandEntity.deadline}",
              style: TextStyle(color: Colors.black, fontSize: 16.sp),
            ),
          ],
        ),
      ),
    );
  }
}
